#pragma once
#include "stdafx.h"

class Algorithm
{
public:
	Algorithm(void);
	~Algorithm(void);
	/**
	* Main function for graph coloring
	*/
	void color(Graph& graph);
private:
	/**
	* Trivial constant needed in the algorithm process: defines max number of consistent unproductive iterations
	*/
	std::size_t MAX_NUMBER_UNPODUCTIVE;
	/**
	* Returns current number of colors
	*/
	std::size_t colorNumber(const Graph& graph);
	/**
	* Checks if there is such color near current vertex
	*/
	bool containsColor(const Vertex& vert, std::size_t colorNum, const Graph& graph);
	/**
	* Initial coloring of graph, without any heuristics
	*/
	void initialColoring(Graph& graph);
	/**
	* Fill up vector with values, needed in algorithm
	*/
	void fillUpVector(const Graph& graph, bool bySizes,std::vector<std::size_t>& gen_sizes);
	/**
	* Applies one iteration of algorithm
	*/
	void applyIteration(Graph& graph, const std::vector<Vertex>& verVector);
	/**
	* Predicat structure needed for vector sorting
	*/
	struct SortPred;
	/**
	*Generates vector needed in algorithm
	*/
	void getVerticesOrderedBy(const Graph& graph, bool bySize, std::vector<Vertex>& vertices,std::vector<std::size_t>& gen_sizes);
};
